package com.ma.cloud.config;

import com.netease.nim.camellia.hot.key.server.console.ConsoleServiceAdaptor;
import com.netease.nim.camellia.http.console.ConsoleResult;
import com.netflix.appinfo.ApplicationInfoManager;
import com.netflix.appinfo.InstanceInfo;
import org.springframework.stereotype.Component;

/**
 * redis热key监控配置类
 *
 * @author mr
 * @since 2025-06-23
 */
@Component
public class RedisConsoleServiceConfig extends ConsoleServiceAdaptor {

    @Override
    public ConsoleResult online() {
        ApplicationInfoManager.getInstance().setInstanceStatus(InstanceInfo.InstanceStatus.UP);
        return super.online();
    }

    @Override
    public ConsoleResult offline() {
        ApplicationInfoManager.getInstance().setInstanceStatus(InstanceInfo.InstanceStatus.DOWN);
        return super.offline();
    }
}